require("dotenv").config();

const express = require("express");
const app = express();
const userRoutes = require("./routes/user");
const blogRoutes = require("./routes/blogs");

const path = require("path");
app.use("/uploads", express.static(path.join(__dirname, "uploads")));

app.use(express.json());
app.use("/user", userRoutes);
app.use("/blogs", blogRoutes);

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`🚀 Server running on http://localhost:${PORT}`);
});

module.exports = app;
